package com.blockmeta.bbs.businesslibrary.util.navigation;

import android.net.Uri;

import java.util.Map;

/**
 * @author AirThor
 * @date 2019/7/24.
 */
public class DeepLinkContext {
    private static IDeepLinkStrategy mIDeepLinkStrategy;


    public static Uri getUri(Uri uri){
        return getStrategyInstance(uri).uriTransformer(uri);
    }

    public static Map<String,String> getParams(Uri uri){
        return getStrategyInstance(uri).navigationParams(uri);
    }

    public static boolean needPostEvents(Uri uri){
        return getStrategyInstance(uri).needSendEvents(uri);
    }

    private static IDeepLinkStrategy getStrategyInstance(Uri uri){
        String key = uri.getHost()+uri.getPath();
        mIDeepLinkStrategy = StrategyFactory.getInstance().creator(key);
        return mIDeepLinkStrategy;
    }
}
